/*package com.example.demo;

import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.io.PrintStream;
import java.util.Map;
import java.util.TimerTask;

import com.example.smart_home.R;

import object.p2pipcam.nativecaller.NativeCaller;

public class AddCameraActivity extends Activity
  implements View.OnClickListener, BridgeService.AddCameraInterface, AdapterView.OnItemSelectedListener, BridgeService.IpcamClientInterface
{
  private static final int SEARCH_TIME = 3000;
  private static final String STR_DID = "did";
  private static final String STR_MSG_PARAM = "msgparam";
  private int CameraType = 2;
  private Handler PPPPMsgHandler = new Handler()
  {
    public void handleMessage(Message paramAnonymousMessage)
    {
      Bundle localBundle = paramAnonymousMessage.getData();
      int i = localBundle.getInt("msgparam");
      int j = paramAnonymousMessage.what;
      String str = localBundle.getString("did");
      Log.i("info", "ppp" + j);
      switch (j)
      {
      default:
        return;
      case 0:
      }
      int k;
      switch (i)
      {
      default:
        k = R.string.pppp_status_unknown;
      case 0:
      case 3:
      case 4:
      case 1:
      case 5:
      case 2:
      case 6:
      case 7:
      }
      while (true)
      {
        AddCameraActivity.this.textView_top_show.setText(AddCameraActivity.this.getResources().getString(k));
        if (i == 2)
          NativeCaller.PPPPGetSystemParams(str, 4);
        if ((i != 5) && (i != 3) && (i != 6) && (i != 7))
          break;
        NativeCaller.StopPPPP(str);
        return;
        k = R.string.pppp_status_connecting;
        AddCameraActivity.this.progressBar.setVisibility(0);
        AddCameraActivity.access$1202(AddCameraActivity.this, 2);
        continue;
        k = R.string.pppp_status_connect_failed;
        AddCameraActivity.this.progressBar.setVisibility(8);
        AddCameraActivity.access$1202(AddCameraActivity.this, 0);
        continue;
        k = R.string.pppp_status_disconnect;
        AddCameraActivity.this.progressBar.setVisibility(8);
        AddCameraActivity.access$1202(AddCameraActivity.this, 0);
        continue;
        k = R.string.pppp_status_initialing;
        AddCameraActivity.this.progressBar.setVisibility(0);
        AddCameraActivity.access$1202(AddCameraActivity.this, 2);
        continue;
        k = R.string.pppp_status_invalid_id;
        AddCameraActivity.this.progressBar.setVisibility(8);
        AddCameraActivity.access$1202(AddCameraActivity.this, 0);
        continue;
        k = R.string.pppp_status_online;
        AddCameraActivity.this.progressBar.setVisibility(8);
        AddCameraActivity.access$1202(AddCameraActivity.this, 1);
        continue;
        k = R.string.device_not_on_line;
        AddCameraActivity.this.progressBar.setVisibility(8);
        AddCameraActivity.access$1202(AddCameraActivity.this, 0);
        continue;
        k = R.string.pppp_status_connect_timeout;
        AddCameraActivity.this.progressBar.setVisibility(8);
        AddCameraActivity.access$1202(AddCameraActivity.this, 0);
      }
    }
  };
  private boolean blagg = false;
  boolean bthread = true;
  private Button btnSearchCamera;
  private Button button_play = null;
  private Button button_setting = null;
  private EditText didEdit = null;
  private Button done;
  private WifiInfo info = null;
  private Intent intentbrod = null;
  private boolean isSearched;
  private SearchListAdapter listAdapter = null;
  private WifiManager manager = null;
  private MyWifiThread myWifiThread = null;
  private int option = 65535;
  private ProgressBar progressBar = null;
  private ProgressDialog progressdlg = null;
  private EditText pwdEdit = null;
  private MyBroadCast receiver;
  private int tag = 0;
  private TextView textView_top_show = null;
  Handler updateListHandler = new Handler()
  {
    public void handleMessage(Message paramAnonymousMessage)
    {
      if (paramAnonymousMessage.what == 1)
      {
        AddCameraActivity.this.listAdapter.notifyDataSetChanged();
        if (AddCameraActivity.this.listAdapter.getCount() > 0)
        {
          AlertDialog.Builder localBuilder = new AlertDialog.Builder(AddCameraActivity.this);
          localBuilder.setTitle(AddCameraActivity.this.getResources().getString(R.string.add_search_result));
          localBuilder.setPositiveButton(AddCameraActivity.this.getResources().getString(R.string.refresh), new DialogInterface.OnClickListener()
          {
            public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
            {
              AddCameraActivity.this.startSearch();
            }
          });
          localBuilder.setNegativeButton(AddCameraActivity.this.getResources().getString(R.string.str_cancel), null);
          localBuilder.setAdapter(AddCameraActivity.this.listAdapter, new DialogInterface.OnClickListener()
          {
            public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
            {
              Map localMap = AddCameraActivity.this.listAdapter.getItemContent(paramAnonymous2Int);
              if (localMap == null)
                return;
              ((String)localMap.get("camera_name"));
              String str = (String)localMap.get("cameraid");
              AddCameraActivity.this.userEdit.setText("admin");
              AddCameraActivity.this.pwdEdit.setText("");
              AddCameraActivity.this.didEdit.setText(str);
            }
          });
          localBuilder.show();
        }
      }
      else
      {
        return;
      }
      Toast.makeText(AddCameraActivity.this, AddCameraActivity.this.getResources().getString(R.string.add_search_no), 1).show();
      AddCameraActivity.access$902(AddCameraActivity.this, false);
    }
  };
  Runnable updateThread = new Runnable()
  {
    public void run()
    {
      NativeCaller.StopSearch();
      AddCameraActivity.this.progressdlg.dismiss();
      Message localMessage = AddCameraActivity.this.updateListHandler.obtainMessage();
      localMessage.what = 1;
      AddCameraActivity.this.updateListHandler.sendMessage(localMessage);
    }
  };
  private EditText userEdit = null;

  private void InitParams()
  {
    this.done.setOnClickListener(this);
    this.btnSearchCamera.setOnClickListener(this);
  }

  private void StartCameraPPPP()
  {
    try
    {
      Thread.sleep(100L);
      label6: int i = NativeCaller.StartPPPP(SystemValue.deviceId, SystemValue.deviceName, SystemValue.devicePass);
      System.out.println("StartPPPP result:" + i);
      return;
    }
    catch (Exception localException)
    {
      break label6;
    }
  }

  private void done()
  {
    Intent localIntent = new Intent();
    String str1 = this.userEdit.getText().toString();
    String str2 = this.pwdEdit.getText().toString();
    String str3 = this.didEdit.getText().toString();
    if (str3.length() == 0)
    {
      Toast.makeText(this, getResources().getString(R.string.input_camera_id), 0).show();
      return;
    }
    if (str1.length() == 0)
    {
      Toast.makeText(this, getResources().getString(R.string.input_camera_user), 0).show();
      return;
    }
    if (this.option == 65535)
      this.option = 1;
    localIntent.putExtra("camera_option", this.option);
    localIntent.putExtra("cameraid", str3);
    localIntent.putExtra("camera_user", str1);
    localIntent.putExtra("camera_pwd", str2);
    localIntent.putExtra("camera_type", this.CameraType);
    this.progressBar.setVisibility(0);
    SystemValue.deviceName = str1;
    SystemValue.deviceId = str3;
    SystemValue.devicePass = str2;
    BridgeService.setIpcamClientInterface(this);
    NativeCaller.Init();
    new Thread(new StartPPPPThread()).start();
  }

  private void findView()
  {
    this.progressBar = ((ProgressBar)findViewById(R.id.main_model_progressBar1));
    this.textView_top_show = ((TextView)findViewById(R.id.login_textView1));
    this.button_play = ((Button)findViewById(R.id.play));
    this.button_setting = ((Button)findViewById(R.id.setting));
    this.done = ((Button)findViewById(R.id.done));
    this.done.setText("   锟斤拷       锟斤拷       ");
    this.userEdit = ((EditText)findViewById(R.id.editUser));
    this.pwdEdit = ((EditText)findViewById(R.id.editPwd));
    this.didEdit = ((EditText)findViewById(R.id.editDID));
    this.btnSearchCamera = ((Button)findViewById(R.id.btn_searchCamera));
    this.button_play.setOnClickListener(this);
    this.button_setting.setOnClickListener(this);
  }

  public static String int2ip(long paramLong)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append(paramLong & 0xFF).append(".");
    localStringBuilder.append(0xFF & paramLong >> 8).append(".");
    localStringBuilder.append(0xFF & paramLong >> 16).append(".");
    localStringBuilder.append(0xFF & paramLong >> 24);
    return localStringBuilder.toString();
  }

  private void searchCamera()
  {
    if (!this.isSearched)
    {
      this.isSearched = true;
      startSearch();
      return;
    }
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setTitle(getResources().getString(R.string.add_search_result));
    localBuilder.setPositiveButton(getResources().getString(R.string.refresh), new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        AddCameraActivity.this.startSearch();
      }
    });
    localBuilder.setNegativeButton(getResources().getString(R.string.str_cancel), null);
    localBuilder.setAdapter(this.listAdapter, new DialogInterface.OnClickListener()
    {
      public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
      {
        Map localMap = AddCameraActivity.this.listAdapter.getItemContent(paramAnonymousInt);
        if (localMap == null)
          return;
        ((String)localMap.get("camera_name"));
        String str = (String)localMap.get("cameraid");
        AddCameraActivity.this.userEdit.setText("admin");
        AddCameraActivity.this.pwdEdit.setText("");
        AddCameraActivity.this.didEdit.setText(str);
      }
    });
    localBuilder.show();
  }

  private void startSearch()
  {
    this.listAdapter.ClearAll();
    this.progressdlg.setMessage(getString(R.string.searching_tip));
    this.progressdlg.show();
    new Thread(new SearchThread(null)).start();
    this.updateListHandler.postDelayed(this.updateThread, 3000L);
  }

  public void BSMsgNotifyData(String paramString, int paramInt1, int paramInt2)
  {
    Log.d("锟斤拷锟斤拷", "type:" + paramInt1 + " param:" + paramInt2);
    Bundle localBundle = new Bundle();
    Message localMessage = this.PPPPMsgHandler.obtainMessage();
    localMessage.what = paramInt1;
    localBundle.putInt("msgparam", paramInt2);
    localBundle.putString("did", paramString);
    localMessage.setData(localBundle);
    this.PPPPMsgHandler.sendMessage(localMessage);
    if (paramInt1 == 0)
    {
      this.intentbrod.putExtra("ifdrop", paramInt2);
      sendBroadcast(this.intentbrod);
    }
  }

  public void BSSnapshotNotify(String paramString, byte[] paramArrayOfByte, int paramInt)
  {
  }

  public void CameraStatus(String paramString, int paramInt)
  {
  }

  public void callBackSearchResultData(int paramInt1, String paramString1, String paramString2, String paramString3, String paramString4, int paramInt2)
  {
    if (!this.listAdapter.AddCamera(paramString1, paramString2, paramString3));
  }

  public void callBackUserParams(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7)
  {
  }

  public int getInfoIp()
  {
    this.info = this.manager.getConnectionInfo();
    return this.info.getIpAddress();
  }

  public String getInfoSSID()
  {
    this.info = this.manager.getConnectionInfo();
    return this.info.getSSID();
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    if (paramInt2 == -1)
    {
      String str = paramIntent.getExtras().getString("result");
      this.didEdit.setText(str);
    }
  }

  public void onClick(View paramView)
  {
    int i = paramView.getId();
    if (i == R.id.play)
      startActivity(new Intent(this, PlayActivity.class));
    do
    {
      return;
      if (i == R.id.setting)
      {
        if (this.tag == 1)
        {
          Intent localIntent = new Intent(this, SettingWifiActivity.class);
          localIntent.putExtra("cameraid", SystemValue.deviceId);
          localIntent.putExtra("camera_name", SystemValue.deviceName);
          startActivity(localIntent);
          overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
          return;
        }
        Toast.makeText(this, getResources().getString(R.string.main_setting_prompt), 0).show();
        return;
      }
      if (i == R.id.done)
      {
        if (this.tag == 1)
        {
          Toast.makeText(this, "锟斤拷锟斤拷锟斤拷丫锟斤拷锟斤拷锟斤拷锟斤拷锟阶刺�...", 0).show();
          return;
        }
        if (this.tag == 2)
        {
          Toast.makeText(this, "锟斤拷锟斤拷锟斤拷锟接ｏ拷锟斤拷锟皆猴拷...", 0).show();
          return;
        }
        done();
        return;
      }
    }
    while (i != R.id.btn_searchCamera);
    searchCamera();
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(R.layout.add_camera);
    getIntent();
    this.progressdlg = new ProgressDialog(this);
    this.progressdlg.setProgressStyle(0);
    this.progressdlg.setMessage(getString(R.string.searching_tip));
    this.listAdapter = new SearchListAdapter(this);
    findView();
    this.manager = ((WifiManager)getSystemService("wifi"));
    InitParams();
    BridgeService.setAddCameraInterface(this);
    this.receiver = new MyBroadCast(null);
    IntentFilter localIntentFilter = new IntentFilter();
    localIntentFilter.addAction("finish");
    registerReceiver(this.receiver, localIntentFilter);
    this.intentbrod = new Intent("drop");
  }

  protected void onDestroy()
  {
    super.onDestroy();
    unregisterReceiver(this.receiver);
    NativeCaller.Free();
    Intent localIntent = new Intent();
    localIntent.setClass(this, BridgeService.class);
    stopService(localIntent);
    this.tag = 0;
  }

  public void onItemSelected(AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong)
  {
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if ((paramInt == 4) && (paramKeyEvent.getRepeatCount() == 0))
      finish();
    return false;
  }

  public void onNothingSelected(AdapterView<?> paramAdapterView)
  {
  }

  protected void onResume()
  {
    super.onResume();
    this.blagg = true;
  }

  protected void onStart()
  {
    super.onStart();
  }

  protected void onStop()
  {
    if (this.myWifiThread != null)
      this.blagg = false;
    this.progressdlg.dismiss();
    NativeCaller.StopSearch();
    super.onStop();
  }

  private class MyBroadCast extends BroadcastReceiver
  {
    private MyBroadCast()
    {
    }

    public void onReceive(Context paramContext, Intent paramIntent)
    {
      AddCameraActivity.this.finish();
      Log.d("tag", "AddCameraActivity.this.finish()");
    }
  }

  class MyTimerTask extends TimerTask
  {
    MyTimerTask()
    {
    }

    public void run()
    {
      AddCameraActivity.this.updateListHandler.sendEmptyMessage(100000);
    }
  }

  class MyWifiThread extends Thread
  {
    MyWifiThread()
    {
    }

    public void run()
    {
      while (AddCameraActivity.this.blagg == true)
      {
        super.run();
        AddCameraActivity.this.updateListHandler.sendEmptyMessage(100000);
        try
        {
          Thread.sleep(1000L);
        }
        catch (InterruptedException localInterruptedException)
        {
          localInterruptedException.printStackTrace();
        }
      }
    }
  }

  private class SearchThread
    implements Runnable
  {
    private SearchThread()
    {
    }

    public void run()
    {
      Log.d("tag", "startSearch");
      NativeCaller.StartSearch();
    }
  }

  class StartPPPPThread
    implements Runnable
  {
    StartPPPPThread()
    {
    }

    public void run()
    {
      try
      {
        Thread.sleep(100L);
        AddCameraActivity.this.StartCameraPPPP();
        return;
      }
      catch (Exception localException)
      {
      }
    }
  }
}

 Location:           D:\Program Files\Android\dex2jar-0.0.9.15\classes_dex2jar.jar
 * Qualified Name:     com.ipcamer.demo.AddCameraActivity
 * JD-Core Version:    0.6.2
 */